# -*- coding: utf-8 -*-


from pyExcelerator import *
from datetime import datetime


class Xport:
    def __init__(self, data, sheet, filename):
        w = Workbook()
        ws = w.add_sheet(sheet)
        self.data = data
        self.filename = filename        

        i = 0        
        for item in self.data:
            j = 0
            for cell in item:
                ws.write(i, j, cell)
                j = j +1
            i = i +1
        
        #ws.write(4, 1, Formula("SUM(B1:B3)"))
        try:
            w.save(self.filename)
        except IOError, io:
            print io



def test():
    data=((1,2,3),(4,5,6),(7,8,9))
    sheet = u'工资单'
    x = Xport(data, sheet)
if __name__ == "__main__":
    test()
    
